<?php
namespace jy_business_card;
defined('BY_JYA') or exit('error');
/*
	分红插件工具类
*/
class model extends \plugin{
	
	public function upfee($order=array()){
		$basic=$this->plugin_setting('basic');
		if(!$basic['is_fee']){
			return false;
		}
		if($basic['userrate']){
			$ratefee=$order['price']*$basic['userrate']/100;
			model('core/member')->member_credit($order['tomid'],'credit2',$ratefee,true,'jy_business_card','客户付费查看信息');
		}
		$fromuser=pdo_getcolumn('core_members',array('uniacid'=>$_SESSION['uniacid'],'id'=>$order['mid']),'fromuser');
		if($fromuser && $basic['rate']){
			$ratefee=$order['price']*$basic['rate']/100;
			model('core/member')->member_credit($fromuser,'credit2',$ratefee,true,'jy_business_card','下级付费查看信息');
		}
		return true;
	}
}